'use strict';

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;

gulp.task('inputfile',function(){
  return gulp.src([
    'src/**/*.scss'
  ])
  .pipe($.sass({
      precision: 10,
      onError: console.error.bind(console, 'Sass error:')
    }))
  .pipe(gulp.dest('dist/css'))
  .pipe($.size({title:'styles'}))
  .pipe(reload({stream:true}));
});

gulp.task('inputfile:browsersync',['inputfile'], function() {
  browserSync({
    notify: false,
    server: {
      baseDir: ['./']
    }
  });

  gulp.watch("src/**/*.scss",['inputfile']);
  gulp.watch("*.html").on('change',reload);
});
gulp.task('default',['inputfile:browsersync'])
